<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>编辑商品推广信息</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="../../css/public.css" media="all">
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>

<div class="layui-form layuimini-form"  lay-filter="editUserFilter" >




    <div class="layui-form-item">
        <div class="layui-input-block">
            <input type="hidden" name="ocid" >
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label required">订单编号</label>
        <div class="layui-input-block">
            <input type="text" name="orderId" lay-verify="required" lay-reqtext="订单编号不能为空" placeholder="请输入订单编号"
                   value=""
                   class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label required">订单金额</label>
        <div class="layui-input-block">
            <input type="text" name="orderMoney" lay-verify="required" lay-reqtext="订单金额不能为空" placeholder="请输入订单金额"
                   value=""
                   class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label required">订单佣金</label>
        <div class="layui-input-block">
            <input type="text" name="orderPMoney" lay-verify="required" lay-reqtext="订单佣金不能为空" placeholder="请输入订单佣金"
                   value=""
                   class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
        </div>
    </div>
</div>
<script src="../../lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script>
    var data;

    /**
     * 主页面向edit.html传递参数
     * @param data
     */
    function child(data) {
        console.log(data);
        this.data = data;
    }

    layui.use(['form', 'element', 'laydate'], function () {
        var form = layui.form,
            layer = layui.layer,
            element = layui.element,
            $ = layui.$;
        laydate = layui.laydate;


        //初始化表单

        form.val("editUserFilter", { //formTest 即 class="layui-form" 所在元素属性 lay-filter="" 对应的值
            "ocid": data.ocid,
            "orderId": data.orderId,
            "orderMoney": data.orderMoney,
            "orderPMoney": data.orderPMoney
        });

        //监听菜单
        form.on('submit(saveBtn)', function (data) {
            $.post("/wfx_manager/orderCount/updateOrderCount", data.field,
                function (res) {
                    if (res.flag) {
                        //获取iframe的唯一标识
                        var iframeIndex = parent.layer.getFrameIndex(window.name);
                        //关闭iframe窗口
                        parent.layer.close(iframeIndex);
                    }
                });
            return false;
        });

    });
</script>
</body>
</html>